package cn.iocoder.yudao.module.erp.dal.mysql.erpSupplierguide;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.erp.dal.dataobject.erpSupplierguide.ErpSupplierGuideDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.erp.controller.admin.erpSupplierguide.vo.*;

import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;

/**
 * ERP 供应商指导价 Mapper
 *
 * @author xc
 */
@Mapper
public interface ErpSupplierGuideMapper extends BaseMapperX<ErpSupplierGuideDO> {

    default PageResult<ErpSupplierGuideDO> selectPage(ErpSupplierGuidePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ErpSupplierGuideDO>()
                .likeIfPresent(ErpSupplierGuideDO::getName, reqVO.getName())
                .eqIfPresent(ErpSupplierGuideDO::getSupplierId, reqVO.getSupplierId())
                .betweenIfPresent(ErpSupplierGuideDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ErpSupplierGuideDO::getId));
    }

    default PageResult<ErpSupplierGuideDO> selectPage(PageParam reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ErpSupplierGuideDO>()
                .eq(ErpSupplierGuideDO::getSupplierId, getLoginUserId())
                .orderByDesc(ErpSupplierGuideDO::getId));
    }

}
